package cn.frank.framework.king.conf.init.listener;

import org.springframework.boot.context.event.ApplicationContextInitializedEvent;
import org.springframework.context.ApplicationListener;

/**
 * @description: TODO
 * @author: renjiangyang
 * @date 2025/7/31 11:24:35
 * @since 1.8
 */
// ✅ 上下文初始化：ApplicationContext 创建完毕，但未刷新
public class ContextInitializedListener implements ApplicationListener<ApplicationContextInitializedEvent> {

    /**
     * 1. ApplicationStartingEvent
     * 2. ApplicationEnvironmentPreparedEvent
     * 3. ✅ ApplicationContextInitializedEvent   <-- 你监听的就是这个
     * 4. ApplicationPreparedEvent
     * 5. ContextRefreshedEvent
     * 6. ApplicationStartedEvent
     * 7. ApplicationReadyEvent
     */
    @Override
    public void onApplicationEvent(ApplicationContextInitializedEvent event) {
        System.out.println(" [2] ApplicationContext 已初始化");
    }
}
